10 CLEAR1500:CLS(3):PRINT@192,"     TREASURES OF BARSOOM":GOTO1230
20 DR$="NSEWUD":R=1:TR=2
30 CLS:PRINT:PRINTR$(R):PRINT:IFN(R)=0THEN70
40 PRINT"LOOKING AROUND ME I CAN SEE: ",:FORO=1TONO:IFO(O)<>R THEN NEXT:GOTO60
50 PRINTO$(O),:NEXT
60 PRINT
70 PRINT"DIRECTIONS I CAN TRAVEL TO: ",:FORD=1TO6:IFE(R,D)>0THENPRINTD$(D),
80 NEXT:PRINT:PRINT"-------------------------------"
90 IFSK=0THENGOSUB1170:GOTO100
92 SK=0
100 F1$="":C$="":F$="":S$="":INPUT"WHAT NOW";C$:IFLEN(C$)=0THEN100
101 FORX=1TOLEN(C$):M$=MID$(C$,X,1)
110 IFM$=" "THEN120
111 F1$=F1$+M$:NEXT
120 IFLEN(F1$)=LEN(C$)THEN140
130 S$=RIGHT$(C$,LEN(C$)-LEN(F1$)-1)
140 F$=LEFT$(F1$,3):S1$=S$:S$=LEFT$(S$,3):FORF=1TONF:IFF$(F)<>F$ THEN142
141 GOTO170
142 NEXT
150 FORD=1TO6:IFF$=MID$(DR$,D,1)THENS$=X$(D):GOTO180
151 NEXT
160 PRINT"I DON'T KNOW HOW TO DO THAT.":GOTO100
170 ONF GOTO180,210,290,320,330,360,380,400,410,530,630,1100,710,770,820,870,910,210,940,960,970,980,1010,1040
180 FORD=1TO6:IFX$(D)<>S$ THEN NEXT:GOTO410
190 IFE(R,D)=0 THEN PRINT"I CAN'T GO THAT WAY.":GOTO100
191 R=E(R,D)
200 GOTO1070
210 GOSUB1080:IFO(O)=0THENPRINT"I ALREADY HAVE IT!":GOTO100
220 IFC=6THENPRINT"I CAN'T CARRY ANYTHING ELSE.":GOTO100
230 ONQ(O)+1GOTO280,240,250,260,270
240 PRINT"SORRY, I CAN'T DO THAT. I'M NOT SUPERMAN!":GOTO100
250 PRINT"THAT'S IMPOSSIBLE!":GOTO100
260 PRINT"I DON'T WANT TO DESTROY THE     SCENERY!":GOTO100
270 PRINT"I TRY TO LIFT IT BUT IT'S TOO   HEAVY.":GOTO90
280 O(O)=0:C=C+1:N(R)=N(R)-1:GOTO1160
290 PRINT"I AM CARRYING THE FOLLOWING:",:IFC=0THENPRINT"NOTHING":GOTO90
300 FORO=1TONO:IFO(O)<>0THENNEXT:PRINT:GOTO90
310 PRINTO$(O),:NEXT:PRINT:GOTO90
320 IFS$<>""THENPRINT"TRY EXAMINING IT.":GOTO100
321 GOTO1100
330 YS=0:FORO=1TONO:IFO(O)=TR THENYS=YS+T(O)
340 NEXT:PRINT"YOU HAVE"YS"OUT OF A            POSSIBLE"HS"POINTS."
341 IFYS=HS THENPRINT"YOU HAVE DISCOVERED ALL THE     SECRETS OF BARSOOM!":GOTO400
350 GOTO90
360 GOSUB1130:IFO(O)<>0THEN1150
361 O(O)=R:C=C-1:N(R)=N(R)+1
370 GOTO1160
380 IFH$(R)=""THENPRINT"I DON'T KNOW WHAT TO DO.":GOTO100
390 PRINTH$(R):GOTO90
400 INPUT"THIS GAME IS OVER.  DO YOU WANT TO PLAY AGAIN";P$:IFLEFT$(P$,1)="Y"THENRUN
401 CLS:END
410 GOSUB1080:IFO<>1ANDO<>3ANDO<>8ANDO<>13ANDO<>14ANDO<>15ANDO<>17ANDO<>22ANDO<>25ANDO<>26THEN1120
420 IFO<>3THEN430
421 R=1:GOTO1070
430 IFO<>8THEN440
431 R=5:GOTO1070
440 IFO<>1THEN450
441 R=4:GOTO1070
450 IFO<>15THEN460
451 R=18:GOTO1070
460 IFO<>13THEN470
461 R=21:GOTO1070
470 IFO<>17THEN490
471 IFR=23THENR=24:GOTO1070
480 IFR=26THENR=25:GOTO1070
490 IFO<>22THEN500
491 R=48:GOTO1070
500 IFO<>25THEN510
501 R=12:GOTO1070
510 IFO<>26THEN520
511 R=49:GOTO1070
520 R=15:GOTO1070
530 GOSUB1080:IFO<>4ANDO<>6ANDO<>7ANDO<>19THENPRINT"IT LOOKS ORDINARY TO ME.":GOTO90
540 IFO<>4THEN560
541 PRINT"THERE'S AN INSCRIPTION ON IT."
550 O(5)=R:N(R)=N(R)+1:GOTO90
560 IFO<>6THEN590
570 IFO(9)<>-1THENPRINT"I SEE NOTHING IN THEM.":GOTO90
571 O(9)=R
580 GOSUB2460:PRINT"I FOUND A BOOK!":GOTO90
590 IFO<>7THEN620
600 IFO(10)<>-1THENPRINT"I SEE NOTHING IN IT.":GOTO90
601 O(10)=R
610 GOSUB2460:PRINT"I FOUND A KEY!":GOTO90
620 PRINT"IT HAS A RUSTY LOCK ON IT.":GOTO90
630 GOSUB1080:IFO<>5ANDO<>9THEN1120
631 IFO<>5THEN650
640 PRINT"INSCRIPTION SAYS: GIVE MY       REGARDS TO THE KEEPER OF THE    RECORDS.":PRINTTAB(40)"RANON OF LYMBAR":GOTO90
650 IFO(9)<>0THEN1150
651 IFBK<2THENPRINT"IT'S CLOSED!":GOTO100
660 ONPG GOTO670,680,690,700
670 PRINT"PAGE 1: CODE BOOK":PRINT"PAGE 2: AAEA ":PRINT"        AN AARDVARK EATS ANTS":GOTO90
680 PRINT"PAGE 3: GSAE":PRINT"        GO SUCK AN EGG":PRINT"PAGE 4: BMAD":PRINT"        BUY ME A DRINK":GOTO90
690 PRINT"PAGE 5: SADW":PRINT"        SAY A DIRTY WORD":PRINT"PAGE 6: SLIT":PRINT"        SAY LYMBAR IN TOMB":GOTO90
700 PRINT"PAGE 7: SRTB":PRINT"        STOP READING THIS BOOK"
701 PRINT"PAGE 8: IBFYH":PRINT"        IT'S BAD FOR YOUR HEALTH":GOTO90
710 GOSUB1080:IFO<>2ANDO<>9ANDO<>19THEN1120
711 IFO<>2THEN730
720 O(8)=R:GOTO1070
730 IFO<>9THEN750
731 IFBK=0THENPRINT"IT'S LOCKED!":GOTO90
732 BK=2
740 PG=1:GOTO1160
750 IFLS=1THENO(21)=R:N(R)=N(R)+1:GOTO1100
760 PRINT"IT'S LOCKED!":GOTO90
770 GOSUB1080:IFO<>2ANDO<>9THEN1120
771 IFO=9THEN790
780 PRINT"IT'S ALREADY UNLOCKED.":GOTO100
790 IFO(10)<>0THENPRINT"I DON'T HAVE THE KEY!":GOTO100
800 IFBK>0THENPRINT"IT'S ALREADY UNLOCKED.":GOTO100
801 BK=1
810 GOTO1160
820 IFS$<>"PAG"THEN1120
830 IFO(9)<>0 THENPRINT"I DON'T HAVE A BOOK!":GOTO100
840 IFBK<2THENPRINT"THE BOOK'S NOT OPEN.":GOTO100
841 PG=PG+1
850 IFPG=5THENPRINT"KABLOOEY!THE BOMB BLEW UP IN MY FACE! NEXT TIME HEED GOOD ADVICE":GOTO400
860 GOTO1160
870 GOSUB1080:IFO<>2ANDO<>9THEN1120
871 IFO<>2THEN890
872 O(8)=-1
880 GOSUB2460:GOTO1070
890 IFO(9)<>0THEN1150
900 IFBK<2THENPRINT"IT'S ALREADY CLOSED.":GOTO100
901 BK=1:GOTO1160
910 IFS$<>"REG"THEN1120
920 IFR<>8ORRG=1THENPRINT"NOTHING HAPPENS.":GOTO90
930 PRINT"COMPUTER KEYBOARD/SCREEN SIMULATION:":FORT=1TO2500:NEXT:FORX=1TO8
931 CLS:FORT=1TO150:NEXT:PRINT@238,"SLIT":FORT=1TO100:NEXTT,X:RG=1:GOTO30
940 PRINT"OK":PRINTS1$
941 IFS$="LYM"ANDR=11ANDO(13)<>R THENPRINT"A TILE IN THE FLOOR SLIDES BACK,REVEALING A HOLE.":O(13)=R:GOSUB2460:GOTO90
950 GOTO90
960 INPUT"PRESS PLAY + RECORD & HIT ENTER (Q=QUIT)";P$:IFP$="Q"THEN100
961 O(NO+1)=R:O(NO+2)=DS:O(NO+3)=UW:O(NO+4)=BK:O(NO+5)=PG:O(NO+6)=RG:O(NO+7)=DZ:O(NO+8)=LS:O(NO+9)=SH
962 CSAVE*O,S1$:GOTO100
970 INPUT"PRESS PLAY & HIT ENTER (Q=QUIT) ";P$:IFP$="Q"THEN100
971 CLOAD*O,S1$
972 R=O(NO+1):DS=O(NO+2):UW=O(NO+3):BK=O(NO+4):PG=O(NO+5):RG=O(NO+6):DZ=O(NO+7):LS=O(NO+8):SH=O(NO+9)
973 GOSUB2460:GOTO1100
980 IFR<44ORR>46THENPRINT"YOU'VE GOT TO BE KIDDING!":GOTO100
990 IFR=45THENR=47:GOTO1070
991 PRINT"IT'S TOO SHALLOW HERE."
1000 GOTO100
1010 IFS$<>"LOC"THEN1120
1020 IFO(20)<>0PRINT"I HIT IT, BUT NOTHING HAPPENS.":GOTO90
1030 LS=1:GOTO1160
1040 IFO(24)<>0THENPRINT"WITH MY HANDS?  ARE YOU KIDDING?":GOTO100
1050 IFR<>49THENPRINT"I FIND NOTHING.":GOTO90
1051 O(25)=R:O(26)=12
1060 GOSUB2460:GOTO1100
1070 GOSUB1180:GOTO1110
1080 GOSUB1130:GOSUB1090:RETURN
1090 IFO(O)<>R ANDO(O)<>0THEN1140
1091 RETURN
1100 GOSUB1170
1110 SK=-1:GOTO30
1120 PRINT"I CAN'T DO THAT.":GOTO100
1130 FORO=1TONO:IFN$(O)<>S$ THENNEXT:PRINT"WHAT?":GOTO100
1131 RETURN
1140 PRINT"I DON'T SEE IT HERE.":GOTO100
1150 PRINT"I DON'T HAVE IT.":GOTO100
1160 PRINT"OK":GOTO90
1170 IFR=6THENR=7:GOTO1180
1171 IFR=7THENR=9:GOTO1180
1172 IFR=24THENR=25:O(17)=26:GOSUB2460:GOTO1180
1173 IFR=25THENR=24:O(17)=23:GOSUB2460
1180 IFR>35ANDR<44THENDS=DS+1:IFDS=5THENPRINT"I HAVE DIED OF THIRST!":GOTO400
1190 IFR=47THENUW=UW+1:IFUW=5THENPRINT"I'VE DROWNED!  (I'M NOT A VERY  GOOD SWIMMER.)":GOTO400
1200 IFR=15THENDZ=DZ+1:IFDZ=3THENPRINT"I FAINT FROM DIZZINESS AND A    HUGE MIRROR FALLS AND CRUSHES ME":GOTO400
1210 IFR=48THENSH=SH+1:IFSH=4THENO(23)=R:N(R)=N(R)+1
1220 RETURN
1230 NR=49:DIMR$(NR),N(NR),E(NR,6),H$(NR):R$(1)="I'M IN THE MAIN ROOM OF MY      HUMBLE DWELLING."
1240 DATA2,3,0,0,0,0
1250 R$(2)="I'M IN A STORAGE ROOM.":H$(2)="FIND *TREASURES* AND STORE THEM HERE."
1260 DATA0,1,0,0,0,0
1270 R$(3)="I AM IN MY SLEEPING QUARTERS."
1280 DATA1,0,0,0,0,0
1290 R$(4)="THIS IS THE CLOSET."
1300 DATA0,0,0,2,0,0
1310 R$(5)="I'M OUTSIDE MY DWELLING IN THE  MARTIAN CITY OF BARSOOM. I CAN  SEE VERY TALL BUILDINGS IN THE  DISTANCE. "
1311 R$(5)=R$(5)+"A HIGH WALL SURROUNDS THE CITY.":H$(5)="THERE IS A WAY OUT!"
1320 DATA0,14,6,0,0,0
1330 R$(6)="I'M IN A LONG TUNNEL ON A MOVINGPATHWAY TRAVELING TOWARD THE    EAST."
1340 DATA0,0,0,5,0,0
1350 DATA8,0,0,0,0,0
1360 R$(7)=R$(6):R$(8)="THIS LOOKS LIKE IT MIGHT BE AN  ARCHIVE. THERE IS A LARGE       COMPUTER IN THE CENTER OF THE   ROOM."
1361 H$(8)="USE LITERAL LOGIC."
1370 DATA0,7,0,0,0,0
1380 DATA0,10,0,0,0,0
1390 R$(9)=R$(6):R$(10)="I'M IN A VAST PARK IN THE HEART OF BARSOOM."
1400 DATA0,0,11,12,0,0
1410 R$(11)="I'M IN A LOW DIM ROOM THAT SEEMSTO BE A BURIAL CHAMBER OF SOME  OF THE LESSER NOBLES OF BARSOOM."
1420 DATA0,0,0,10,0,0
1430 DATA0,0,10,13,0,0
1440 R$(12)=R$(10):R$(13)="I AM IN THE CITY OF BARSOOM     PROPER. IT IS A LARGE AND BUSY  METROPOLIS."
1450 DATA0,0,12,14,0,0
1460 R$(14)="I AM ON A WIDE AND BEAUTIFULLY  PAVED PATHWAY."
1470 DATA5,0,13,0,0,0
1480 R$(15)="I AM IN THE HALL OF MIRRORS.    ROTATING MIRRORS SURROUND ME.   I FEEL VERY DIZZY."
1481 H$(15)="I WOULDN'T STAY HERE TOO LONG."
1490 DATA13,0,0,0,16,0
1500 R$(16)="I'M CLIMBING A LONG AND         INFINITELY WINDING STAIRWAY."
1510 DATA0,0,0,0,17,15
1520 R$(17)="I'M AT THE TOWER'S SUMMIT.      I FEEL WARM AIR COMING FROM THE BOTTOM OF THE WALL."
1530 DATA0,0,0,0,0,16
1540 R$(18)="I AM CRAWLING THROUGH A VERY    NARROW VENT."
1550 DATA17,19,0,0,0,0
1560 R$(19)="I'M OUTSIDE OF THE TOWER. THERE IS A MILE-LONG STAIRWAY LEADING DOWN."
1570 DATA18,0,0,0,0,20
1580 R$(20)=" I HAVE CLIMBED DOWN ABOUT AS FARAS I CAN. THERE IS STILL A LONG WAY TO THE BOTTOM."
1590 DATA0,0,0,0,19,0
1600 R$(21)="I'M ON A DIMLY LIT STAIRWAY.":DATA0,0,0,0,11,22
1610 R$(22)="I AM IN WHAT APPEARS TO BE A    CONTROL ROOM OF SOME SORT.":DATA0,0,23,0,21,0
1620 R$(23)="I'M ON A TRANSPARENT ZIRCONIUM  PLATFORM."
1630 DATA23,0,0,22,0,0
1640 R$(24)="I'M IN MY YTTRIUM CAPSULE."
1650 DATA0,0,0,23,0,0
1660 R$(25)=R$(24)
1670 H$(25)="WAITING SOMETIMES PAYS OFF.":DATA0,26,0,0,0,0
1680 R$(26)="I'M ON A TRANSLUCENT HAFNIUM    PLATFORM."
1690 DATA0,27,0,0,0,0
1700 DATA26,28,0,0,36,0
1710 R$(27)=R$(21):R$(28)="CARVED INTO THE WALLS ARE THE   WORDS: CAVERNS OF SYL                  DO NOT ENTER"
1720 DATA27,0,29,0,0,0
1730 R$(29)="I AM IN A VERY DIMLY LIT AND    OMINOUS CAVERN.":DATA29,30,29,29,0,0
1740 R$(30)=R$(29):R$(31)=R$(29)
1750 DATA29,29,31,32,0,0
1760 DATA29,32,31,33,0,0
1770 DATA32,32,30,32,0,0
1780 R$(32)=R$(29):R$(33)=R$(29):R$(34)=R$(29)
1790 DATA32,33,33,34,0,0
1800 DATA35,34,34,34,0,0
1810 DATA35,35,28,35,0,0
1820 R$(35)=R$(29):R$(36)="I'M IN A HUGE AND TRACKLESS     DESERT WASTELAND."
1830 DATA41,36,37,36,0,27
1840 R$(37)=R$(36):R$(38)=R$(36)
1850 DATA40,37,38,36,0,0
1860 DATA39,38,38,37,0,0
1870 DATA44,38,39,40,0,0
1880 R$(39)=R$(36):R$(40)=R$(36):R$(41)=R$(36)
1890 DATA43,37,39,41,0,0
1900 DATA42,36,40,41,0,0
1910 DATA42,41,43,42,0,0
1920 R$(42)=R$(36):R$(43)=R$(36)
1930 DATA43,40,44,42,0,0
1940 R$(44)="SPLASH! I FELL THROUGH A HIDDEN WELL INTO AN UNDERGROUND RIVER."
1950 DATA46,45,0,0,0,0
1960 R$(45)="I'M IN AN UNDERGROUND RIVER, THECURRENT IS STRONG AS I TRY TO   SWIM UPSTREAM."
1970 DATA46,0,0,0,0,0
1980 R$(46)="I'M IN AN UNDERGROUND RIVER AND A VERY STRONG CURRENT IS CARRYING ME DOWNSTREAM."
1990 DATA46,45,0,0,0,0
2000 R$(47)="I'M BENEATH THE SURFACE AND THE STRONG CURRENT. IT'S VERY       PEACEFUL DOWN HERE.":H$(47)="YOU'LL FIGURE IT OUT.
2010 DATA0,0,0,0,45,0
2020 R$(48)="I'M IN A CAVERN ON THE SHORE OF THE RIVER. THE WATER KEEPS      WASHING UP JUNK."
2030 DATA0,0,45,49,0,0
2040 R$(49)="A LONG AND NARROW PASSAGEWAY    ENDS HERE.":NF=24:DIMF$(NF):F$(1)="GO":F$(2)="TAK"
2050 DATA0,0,48,0,0,0
2060 F$(3)="INV":F$(4)="LOO":F$(5)="SCO":F$(6)="DRO":F$(7)="HEL":F$(8)="QUI":F$(9)="ENT":F$(10)="EXA":F$(11)="REA"
2061 F$(12)="WAI":F$(13)="OPE":F$(14)="UNL":F$(15)="TUR":F$(16)="CLO":F$(17)="GIV":F$(18)="GET"
2070 F$(19)="SAY":F$(20)="SAV":F$(21)="LOA":F$(22)="DIV":F$(23)="SMA":F$(24)="DIG":NO=26
2071 DIMO$(NO),O(NO+9),N$(NO),T(NO),Q(NO):O$(1)="CLOSET":N$(1)="CLO":O$(2)="DOOR"
2080 DATA2,0,1
2090 N$(2)="DOO":O$(3)="DWELLING":N$(3)="DWE"
2100 DATA1,0,1
2110 O$(4)="HUGE STONE":N$(4)="STO"
2120 DATA5,0,1
2130 O$(5)="INSCRIPTION":N$(5)="INS"
2140 DATA20,0,1
2150 O$(6)="BUSHES":N$(6)="BUS"
2160 DATA-1,0,2
2170 DATA10,0,3
2180 O$(7)="SCRUBBRUSH":N$(7)="SCR":DATA12,0,3
2190 O$(8)="CITY OUTSIDE":N$(8)="CIT":DATA-1,0,2
2200 O$(9)="BOOK":N$(9)="BOO":O$(10)="KEYS"
2210 DATA-1,0,0
2220 N$(10)="KEY":DATA-1,0,0
2230 O$(11)="COMPUTER TERMINAL":N$(11)="COM"
2240 DATA8,0,2
2250 DATA3,0,1
2260 O$(12)="BED":N$(12)="BED"
2270 O$(13)="HOLE":N$(13)="HOL":DATA-1,0,2
2280 O$(14)="SOARING TOWER":N$(14)="TOW":DATA13,0,1
2290 O$(15)="VENT":N$(15)="VEN":DATA17,0,2
2300 O$(16)="A SIGN SAYING: SUBTRANS":N$(16)="SIG":O$(17)="YTTRIUM CAPSULE"
2310 DATA21,0,0
2320 N$(17)="CAP":O$(18)="*RUBY*"
2330 DATA23,0,1
2340 N$(18)="RUB":DATA35,100,0
2350 O$(19)="OLD CHEST":N$(19)="CHE":DATA47,0,4
2360 O$(20)="HAMMER":N$(20)="HAM":DATA20,0,0
2370 O$(21)="*GOLD COINS*":N$(21)="COI"
2380 DATA-1,150,0
2390 DATA45,0,2
2400 O$(22)="SHORE":N$(22)="SHO"
2410 O$(23)="*DIAMOND*":N$(23)="DIA":DATA-1,200,0
2420 O$(24)="SPADE":N$(24)="SPA":DATA2,0,0
2430 O$(25)="LIGHT ABOVE":N$(25)="LIG":DATA-1,0,2
2440 O$(26)="SMALL CRATER":N$(26)="CRA":DATA-1,0,2
2450 D$(1)="NORTH":D$(2)="SOUTH":D$(3)="EAST":D$(4)="WEST":D$(5)="UP":D$(6)="DOWN":X$(1)="NOR":X$(2)="SOU":X$(3)="EAS"
2451 X$(4)="WES":X$(5)="UP":X$(6)="DOW":FORR=1TONR:FORD=1TO6:READE(R,D):NEXTD,R:FORO=1TONO:READO(O),T(O),Q(O)
2452 HS=HS+T(O):NEXT:GOSUB2460
2455 GOTO20
2460 C=0:FORP=1TONR:N(P)=0:NEXT:FORO=1TONO:J=O(O):IFJ<0THEN2470
2461 IFJ=0THENC=C+1:GOTO2470
2462 N(J)=N(J)+1
2470 NEXT:RETURN
